package com.deepocean.controller;

import com.deepocean.common.entity.ResultEntity;
import com.deepocean.entity.GradingScreenCondition;
import com.deepocean.entity.GradingScreenEntity;
import com.deepocean.service.IGradingScreenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 分级筛
 */
@RestController
@RequestMapping("/gradingScreen")
public class GradingScreenController {

    @Autowired
    private IGradingScreenService gradingScreenService;

    /**
     * 新增接口
     * @param gradingScreenEntity
     * @return
     */
    @PostMapping("/v1/add")
    public ResultEntity add(@RequestBody GradingScreenEntity gradingScreenEntity) {
        return ResultEntity.success(gradingScreenService.add(gradingScreenEntity));
    }

    /**
     * 一小时内物料输入输出总和
     * @param deviceId
     * @return
     */
    @PostMapping("/v1/getInAndOutInHour")
    public ResultEntity getInAndOutInHour(@RequestParam String deviceId) {
        return ResultEntity.success(gradingScreenService.getInAndOutInHour(deviceId));
    }

    /**
     * 条件查询
     * @param gradingScreenCondition
     * @return
     */
    @PostMapping("/v1/getGradingScreenByCondition")
    public ResultEntity getGradingScreenByCondition(@RequestBody GradingScreenCondition gradingScreenCondition) {
        return ResultEntity.success(gradingScreenService.getGradingScreenByCondition(gradingScreenCondition));
    }

    /**
     * 根据设备型号获取理论数据
     * @return
     */
    @PostMapping("/v1/getTheoryData")
    public ResultEntity getTheoryData(String deviceType) {
        return ResultEntity.success("理论数据");
    }
}
